package baiqitun.stupro.security.entity;

import baiqitun.stupro.common.constant.SysConstant;
import baiqitun.stupro.common.entity.Entity;
import baiqitun.stupro.common.validate.group.SaveGroup;
import baiqitun.stupro.common.validate.group.UpdateGroup;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Null;

/**
 * <p>
 * 用户表
 * </p>
 *
 * @author kedaji
 * @since 2020-03-25
 */
@ApiModel("用户")
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("stupro_user")
public class SysUser extends Entity {

    private static final long serialVersionUID=1L;

    @Null(message = SysConstant.ER_PARAMETER_MUST_NULL, groups = UpdateGroup.class)
    @NotBlank(message = "用户名不能为空", groups = {SaveGroup.class})
    @ApiModelProperty("账号")
    private String username;

    @NotBlank(message = "用户名不能为空", groups = {SaveGroup.class})
    @ApiModelProperty("密码")
    private String password;

    @ApiModelProperty("头像")
    private String avatar;

    @ApiModelProperty("真实姓名")
    private String realName;

    @Null(message = SysConstant.ER_PARAMETER_MUST_NULL, groups = {SaveGroup.class, UpdateGroup.class})
    private String enabled;
}
